trigger PrimaryContact on Opportunity (before update) {
	List<OpportunityContactRole> oCRTargeted = [select id, isPrimary, ContactId, OpportunityId from OpportunityContactRole where OpportunityId IN :Trigger.new];
	List<Opportunity> oppsToUpdate = new List<Opportunity>();
	for(OpportunityContactRole oCR : oCRTargeted){
		if(oCR.IsPrimary){
			for(Opportunity o : Trigger.new){
				if(o.Id==oCR.OpportunityId){
					o.Related_Contact__c=oCR.ContactId;
					System.debug('MESSAGEX Primary Contact'+oCR.ContactId);
				}
			}
		}
	}
}